]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/network: Stop using radio-mode for VPN items
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 15 Aug 2022 15:40:52 +0000 (17:40 +0200)
committerMarge Bot <marge-bot@gnome.org>
Tue, 30 Aug 2022 15:43:11 +0000 (15:43 +0000)
If a device has multiple connections set up, then at most one of
those can be active at a time, which is why they are presented
as radio items.

In contrast, VPN connections are not mutually exclusive, each can
be turned on or off independently. Setting :radio-mode on them
currently means that VPN connections can be activated, but never
disabled.

So instead of abusing the :radio-mode property to give VPN items
the UI we want, use regular items that reflect the desired behavior
and explicitly set up the UI the way we want.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2426>

js/ui/status/network.js

index 7a191e03bd7d2c029f0b91a562758e47ce73e6da..4cc9bbdd0244ff576ac4c20c02c2203957dd7664 100644 (file)
@@ -1249,27 +1249,22 @@ const NMVpnConnectionItem = GObject.registerClass({
         super(section, connection);
 
         this._label.x_expand = true;
-        this.radioMode = true;
+        this.accessible_role = Atk.Role.CHECK_MENU_ITEM;
+        this._icon.hide();
 
         this._switch = new PopupMenu.Switch(this.is_active);
         this.add_child(this._switch);
 
-        this.bind_property('radio-mode',
-            this._switch, 'visible',
-            GObject.BindingFlags.SYNC_CREATE);
         this.bind_property('is-active',
             this._switch, 'state',
             GObject.BindingFlags.SYNC_CREATE);
-    }
-
-    _updateOrnament() {
-        this.setOrnament(PopupMenu.Ornament.NONE);
+        this.bind_property('name',
+            this._label, 'text',
+            GObject.BindingFlags.SYNC_CREATE);
     }
 
     _sync() {
-        super._sync();
-
-        if (this.radio_mode && this.is_active)
+        if (this.is_active)
             this.add_accessible_state(Atk.StateType.CHECKED);
         else
             this.remove_accessible_state(Atk.StateType.CHECKED);